<?php

class Admin_logApp extends BackendApp {

    var $_admin_log_mod;

    function __construct() {
        $this->Admin_logApp();
    }

    function Admin_logApp() {
        parent::BackendApp();
        $this->_admin_log_mod = & m('admin_log');
    }

    function index() {
        $conditions = $this->_get_query_conditions(
                array(
                    array(
                        'field' => 'admin_name', //按用户名,店铺名,支付方式名称进行搜索
                        'equal' => 'LIKE',
                        'name' => 'admin_name',
                    ),
                    array(
                        'field' => 'createtime',
                        'name' => 'add_time_from',
                        'equal' => '>=',
                        'handler' => 'gmstr2time',
                    ), array(
                        'field' => 'createtime',
                        'name' => 'add_time_to',
                        'equal' => '<=',
                        'handler' => 'gmstr2time_end',
                    )
        ));
        
        //更新排序
        if (isset($_GET['sort']) && !empty($_GET['order'])) {
            $sort = strtolower(trim($_GET['sort']));
            $order = strtolower(trim($_GET['order']));
            if (!in_array($order, array('asc', 'desc'))) {
                $sort = 'createtime';
                $order = 'desc';
            }
        } else {
            if (isset($_GET['sort']) && empty($_GET['order'])) {
                $sort = strtolower(trim($_GET['sort']));
                $order = "";
            } else {
                $sort = 'createtime';
                $order = 'desc';
            }
        }
        
        $page = $this->_get_page(10);
        $admin_log_list = $this->_admin_log_mod->find(array(
            'conditions' => "1=1 ".$conditions,
            'limit' => $page['limit'],
            'order' => "$sort $order",
            'count' => true
        ));
        $page['item_count'] = $this->_admin_log_mod->getCount();   //获取统计数据
        $this->_format_page($page);
        $this->assign('filtered', $conditions ? 1 : 0); //是否有查询条件
        $this->assign('page_info', $page);   //将分页信息传递给视图，用于形成分页条
        $this->assign('admin_log_list', $admin_log_list);
        $this->import_resource(array('script' => 'jqtreetable.js,inline_edit.js,inline_edit.js,jquery.ui/jquery.ui.js,jquery.ui/i18n/' . i18n_code() . '.js',
                                      'style'=> 'jquery.ui/themes/ui-lightness/jquery.ui.css,res:style/jqtreetable.css'));
        $this->display('admin_log.index.html');
    }

}

?>